﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ParallelArrays;
using FPA = Microsoft.ParallelArrays.FloatParallelArray;
using BPA = Microsoft.ParallelArrays.BoolParallelArray;
using IPA = Microsoft.ParallelArrays.IntParallelArray;
using PA = Microsoft.ParallelArrays.ParallelArrays;

namespace CoreCalc.SheetDefinedFunctions.Accellerator
{
   
    public abstract class AccExpr
    {
        FPA Cache;
        int cachedCallId;
        
        public FPA GenerateFPAWithCache(AccInputInfo info, int CallID)
        {
            if (cachedCallId != CallID || Cache == null)
            { //If not cached, generate FPA and cache
                Cache = GenerateFPA(info, CallID);
                cachedCallId = CallID;
                return Cache;
            }
            else
            { //if cached, simply return the cached FPA
                return Cache;
            }
        }

        protected abstract FPA GenerateFPA(AccInputInfo info, int CallID);
      //  public abstract void Optimize();

        //public abstract int GetRank();
        //public abstract int GetDimensions(int rank);
        //public abstract Value GetValue(float[,] values);
        //public abstract Value GetValue(float[] values);
    }
}
